﻿using System;
using System.Collections.ObjectModel;
using System.Globalization;
using System.Windows.Data;

namespace OpenLS.Spreadsheet.UI.Internals
{
    class FilterColumnViewModelsFactory: IValueConverter
    {
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            ObservableCollection<FilterColumn> filterColumns = (ObservableCollection<FilterColumn>) value;
            if (filterColumns == null)
                return null;
            return new ShadowCollection<FilterColumn, FilterColumnViewModel>(filterColumns, cc => new FilterColumnViewModel(cc));
        }

        public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
        {
            throw new NotSupportedException();
        }
    }
}